var a = require("../../../../@babel/runtime/helpers/defineProperty"), t = getApp();

Page({
    data: {
        show: !1,
        love_name: "",
        active: "speed_pool_record",
        amount: 0,
        member_surplus: 0,
        released_rocord: {},
        speed_pool_record: {},
        account_balance: {},
        speed_pool: "speed_pool",
        income: 0,
        amount_total: 0,
        last_active: ""
    },
    onLoad: function() {
        this.getData(), this.getReleased(), this.getPlusPool();
    },
    getPlusPool: function() {
        var a = this, e = t.getNetAddresss("plugin.love-speed-pool.frontend.plus.index");
        e += "&page=1", t._getNetWork({
            url: e,
            success: function(t) {
                1 == t.data.result && a.setData({
                    amount_total: parseFloat(t.data.data.amount_total),
                    account_balance: t.data.data.list
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    confirm: function() {
        var a = t.getNetAddresss("plugin.love-speed-pool.frontend.receive.handle");
        t._getNetWork({
            url: a,
            success: function(a) {
                wx.showToast({
                    icon: "none",
                    title: a.data.msg,
                    duration: 1500
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    onClickShow: function() {
        0 == this.data.member_surplus ? wx.showToast({
            icon: "none",
            title: "暂无释放的".concat(this.data.love_name, "可领取"),
            duration: 1500
        }) : this.setData({
            show: !0
        });
    },
    onClickHide: function() {
        this.setData({
            show: !1
        });
    },
    onChangeSpeed: function(a) {
        this.setData({
            speed_pool: a.detail.name
        }), "speed_plus_pool" == this.data.speed_pool ? this.setData({
            active: "account_balance",
            last_active: this.data.active
        }) : this.setData({
            active: this.data.last_active
        });
    },
    onChange: function(a) {
        this.setData({
            active: a.detail.name
        });
    },
    PayHandler: function() {
        wx.navigateTo({
            url: "/packageB/member/category/search_v2/search_v2?CommodityRights=CommodityRights"
        });
    },
    onShow: function() {},
    getReleased: function() {
        var a = this, e = t.getNetAddresss("plugin.love-speed-pool.frontend.receive.index");
        t._getNetWork({
            url: e,
            success: function(t) {
                1 == t.data.result && (a.setData({
                    love_name: t.data.data.love_name,
                    amount: parseFloat(t.data.data.amount)
                }), wx.setNavigationBarTitle({
                    title: t.data.data.love_name + "加速池释放"
                }));
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    getData: function() {
        var e = this, o = t.getNetAddresss("plugin.love-speed-pool.frontend.home.index");
        o += "&page=1", t._getNetWork({
            url: o,
            success: function(t) {
                1 == t.data.result && (e.setData({
                    released_rocord: t.data.data.released_rocord,
                    speed_pool_record: t.data.data.speed_pool_record,
                    member_surplus: parseFloat(t.data.data.member_surplus)
                }), e.data.released_rocord.data.forEach(function(a) {
                    return a.love_name = t.data.data.love_name;
                }), e.setData(a({}, "released_rocord.data", e.data.released_rocord.data)));
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    onReachBottom: function() {
        this.data[this.data.active].current_page >= this.data[this.data.active].last_page || this.getMoreData();
    },
    getMoreData: function() {
        var e = this, o = "";
        o = "speed_pool" == this.data.speed_pool ? "plugin.love-speed-pool.frontend.home.index" : "plugin.love-speed-pool.frontend.plus.index";
        var n = t.getNetAddresss(o);
        n += "&page=".concat(this.data[this.data.active].current_page + 1), t._getNetWork({
            url: n,
            success: function(t) {
                if (1 == t.data.result) {
                    var o, n = "", s = 0;
                    "account_balance" == e.data.active ? (n = e.data.account_balance.data.concat(t.data.data.list.data), 
                    s = t.data.data.list.current_page) : (n = e.data[e.data.active].data.concat(t.data.data[e.data.active].data), 
                    s = t.data.data[e.data.active].current_page, "released_rocord" == e.data.active && n.forEach(function(a) {
                        return a.love_name = t.data.data.love_name;
                    }));
                    var d = "".concat(e.data.active, ".data."), c = "".concat(e.data.active, ".current_page");
                    e.setData((a(o = {}, d, n), a(o, c, s), o));
                }
            },
            fail: function(a) {
                console.log(a);
            }
        });
    }
});